package br.edu.unifei.cct720.alieninvasion.resources;

import java.awt.Graphics;
import java.awt.Image;

/**
 * Class to represent entities sprites
 * 
 * @author Felipe Knappe
 *
 */
public class Sprite {
	
	/**
	 * Used to represent the sprite as an image
	 * @uml.property  name="image"
	 */
	private Image image;
	
	/**
	 * Class constructor
	 * Create a new instance of sprint based on an image
	 * 
	 * @param im The representative image
	 */
	public Sprite(Image im) {
		this.image = im;
	}
	
	/**
	 * Method responsible for retrieve the sprite's
	 * width value
	 * 
	 * @return int
	 */
	public int getWidth() {
		return image.getWidth(null);
	}

	/**
	 * Method responsible for retrieve the sprite's
	 * height value
	 * 
	 * @return int
	 */
	public int getHeight() {
		return image.getHeight(null);
	}
	
	/**
	 * Method responsible for draw the sprite within
	 * an specified graphics context
	 * 
	 * @param g The graphics context 
	 * @param x The x-coordinate of the sprite's image 
	 * @param y The x-coordinate of the sprite's image
	 * 
	 */
	public void draw(Graphics g, int x, int y) {
		g.drawImage(image, x, y, null);
	}

}
